home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
398
/
398.xpi
/
chrome
/
forecastfox.jar
/
content
/
bindings.xml
< prev
next >
Wrap
Extensible Markup Language
|
2010-02-04
|
12KB
|
272 lines
<?xml version="1.0"?>
<!--****************************************************************************
Copyright (c) 2008 Ensolis, LLC. All Rights Reserved.
***************************************************************************-->
<!DOCTYPE bindings SYSTEM "chrome://forecastfox/locale/forecastfox.dtd" >
<bindings xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<!-- base binding everything extends -->
<binding id="ff-base">
<resources>
<stylesheet src="chrome://forecastfox/skin/bindings.css"/>
<script type="application/x-javascript" src="chrome://forecastfox/content/ping/tracker.js"/>
</resources>
</binding>
<!-- panel binding -->
<binding id="ff-panel" display="xul:button" extends="chrome://forecastfox/content/bindings.xml#ff-base">
<content>
<xul:image anonid="ff-panel-icon" class="ffpanel-icon" validate="always" xbl:inherits="src, width=imagewidth, height=imageheight"/>
<xul:label class="ffpanel-text" xbl:inherits="value=label,crop"/>
</content>
<implementation>
<property name="label"
onget="return this.getAttribute('label');"
onset="this.setAttribute('label',val); return val;"/>
<property name="src"
onget="return this.getAttribute('src');"
onset="this.setAttribute('src',val); return val;"/>
<property name="imagewidth"
onget="return this.getAttribute('imagewidth');"
onset="this.setAttribute('imagewidth',val); return val;"/>
<property name="imageheight"
onget="return this.getAttribute('imageheight');"
onset="this.setAttribute('imageheight',val); return val;"/>
</implementation>
</binding>
<!-- tooltip binding -->
<binding id="ff-tooltip" extends="chrome://global/content/bindings/popup.xml#tooltip">
<resources>
<stylesheet src="chrome://forecastfox/skin/bindings.css"/>
</resources>
<content>
<xul:hbox class="fftooltip-box" flex="1">
<xul:vbox class="fftooltip-iconbox" align="center" pack="center" xbl:inherits="display">
<xul:image anonid="ff-tooltip-icon" class="fftooltip-icon" validate="always" xbl:inherits="src, width=imagewidth, height=imageheight"/>
</xul:vbox>
<xul:vbox class="fftooltip-textbox" xbl:inherits="display">
<xul:label anonid="ff-tooltip-title" class="fftooltip-title" xbl:inherits="value=title,crop"/>
<xul:vbox anonid="ff-tooltip-labels"/>
</xul:vbox>
<xul:vbox class="fftooltip-adbox" align="center" pack="center">
<xul:image anonid="ff-tooltip-ad" class="fftooltip-ad" validate="always" xbl:inherits="src=adsrc, width=adwidth, height=adheight"/>
</xul:vbox>
</xul:hbox>
</content>
<implementation>
<property name="display"
onget="return this.getAttribute('display');"
onset="this.setAttribute('display',val); return val;"/>
<property name="title"
onget="return this.getAttribute('title');"
onset="this.setAttribute('title',val); return val;"/>
<property name="label"
onget="return this.getAttribute('label');"
onset="this.setAttribute('label',val); return val;"/>
<property name="src"
onget="return this.getAttribute('src');"
onset="this.setAttribute('src',val); return val;"/>
<property name="imagewidth"
onget="return this.getAttribute('imagewidth');"
onset="this.setAttribute('imagewidth',val); return val;"/>
<property name="imageheight"
onget="return this.getAttribute('imageheight');"
onset="this.setAttribute('imageheight',val); return val;"/>
<property name="adsrc"
onget="return this.getAttribute('adsrc');"
onset="this.setAttribute('adsrc',val); return val;"/>
<property name="adwidth"
onget="return this.getAttribute('adwidth');"
onset="this.setAttribute('adwidth',val); return val;"/>
<property name="adheight"
onget="return this.getAttribute('adheight');"
onset="this.setAttribute('adheight',val); return val;"/>
<method name="displayLabel">
<body>
<![CDATA[
var title = document.getAnonymousElementByAttribute(this, "anonid", "ff-tooltip-title");
if (title.value == "")
title.setAttribute("hidden", "true");
else
title.removeAttribute("hidden");
var labels = document.getAnonymousElementByAttribute(this, "anonid", "ff-tooltip-labels");
while(labels.hasChildNodes())
labels.removeChild(labels.lastChild);
if (!this.hasAttribute("label"))
return;
var lbls = this.label.split("/n");
for (var i=0; i<lbls.length; ++i) {
var lbl = document.createElement("label");
if (lbls[i].length > 60) {
var splitpoint = lbls[i].substring(0, 60).lastIndexOf(" ");
if (splitpoint > 0)
lbls.splice(i, 1, lbls[i].substring(0, splitpoint), lbls[i].substr(splitpoint + 1));
};
lbl.setAttribute("value", lbls[i]);
labels.appendChild(lbl);
};
]]>
</body>
</method>
<field name="_parser">null</field>
<property name="parser">
<getter>
<![CDATA[
if (!this._parser) {
var mgrService = Components.classes["@ensolis.com/forecastfox/manager-service;1"].
getService(Components.interfaces.ffIManagerService)
this._parser = mgrService.parser;
}
return this._parser;
]]>
</getter>
</property>
<method name="fillPopup">
<parameter name="panel"/>
<body>
<![CDATA[
// tooltip isn't enabled
var enabled = panel.getAttribute("tooltipenabled");
enabled = (enabled == "true");
if (!enabled)
return false;
//set the tooltip attributes
this.title = panel.getAttribute("tooltiptitle");
this.label = panel.getAttribute("tooltiplabel");
this.display = panel.getAttribute("tooltipdisplay");
this.src = panel.getAttribute("tooltipsrc");
this.imagewidth = panel.getAttribute("tooltipwidth");
this.imageheight = panel.getAttribute("tooltipheight");
var adsrc = this.parser.getValue("ad", 0, "imagepath", null);
if (panel.getAttribute("tooltipad") == "true" && adsrc && adsrc != "N/A") {
this.adsrc = adsrc;
this.adwidth = this.parser.getValue("ad", 0, "imagewidth", null);
this.adheight = this.parser.getValue("ad", 0, "imageheight", null);
FFTracker.trackURL(this.parser.getValue("ad", 0, "track", null));
} else {
this.adsrc = "";
this.adwidth = 0;
this.adheight = 0;
}
this.displayLabel();
// fire the tracker event
if (panel.getAttribute("prefix") == "logo")
FFTracker.trackURL(this.parser.getValue("logo", 0, "tooltiptrack", null));
else
FFTracker.tooltipLoad(panel.getAttribute("prefix"));
//show the tooltip
return true;
]]>
</body>
</method>
</implementation>
<handlers>
<handler event="popupshowing">
<![CDATA[
var panel = document.tooltipNode;
return this.fillPopup(panel);
]]>
</handler>
</handlers>
</binding>
<!-- header no content binding -->
<binding id="ff-header" extends="chrome://forecastfox/content/bindings.xml#ff-base">
<content>
<xul:box class="ffheader-box" xbl:inherits="align=headeralign, pack=headerpack, orient=headerorient, dir=headerdir" flex="1">
<xul:description class="ffheader-text" xbl:inherits="value=title,crop"/>
</xul:box>
</content>
<implementation>
<property name="title"
onget="return this.getAttribute('title');"
onset="this.setAttribute('title',val); return val;"/>
</implementation>
</binding>
<!-- header content binding -->
<binding id="ff-header-complex" extends="chrome://forecastfox/content/bindings.xml#ff-base">
<content>
<xul:box class="ffheader-box" xbl:inherits="align=headeralign, pack=headerpack, orient=headerorient, dir=headerdir" flex="1">
<children/>
</xul:box>
</content>
</binding>
<!-- link binding -->
<binding id="ff-link" display="xul:button" extends="chrome://forecastfox/content/bindings.xml#ff-base">
<content>
<xul:label class="fflink-text" xbl:inherits="value=label,crop,tooltiptext"/>
</content>
<implementation implements="nsIAccessibleProvider">
<field name="_mgrSvc">null</field>
<constructor>
const Cc = Components.classes;
const Ci = Components.interfaces;
this._mgrSvc = Cc["@ensolis.com/forecastfox/manager-service;1"].getService(Ci.ffIManagerService);
</constructor>
<destructor>
this._mgrSvc = null;
</destructor>
<property name="accessible">
<getter>
<![CDATA[
const Cc = Components.classes;
const Ci = Components.interfaces;
var acSvc = Cc["@mozilla.org/accessibilityService;1"].getService(Ci.nsIAccessibilityService);
return acSvc.createXULLinkAccessible(this);
]]>
</getter>
</property>
<property name="label"
onget="return this.getAttribute('label');"
onset="this.setAttribute('label',val); return val;"/>
<property name="href"
onget="return this.getAttribute('href');"
onset="this.setAttribute('href', val); return val;"/>
<property name="from"
onget="return this.getAttribute('from');"
onset="this.setAttribute('from', val); return val;"/>
<property name="partner">
<setter>
<![CDATA[
if (val)
this.setAttribute("partner", "true");
else
this.setAttribute("partner", "false");
return val;
]]>
</setter>
<getter>
return this.getAttribute("partner");
</getter>
</property>
</implementation>
<handlers>
<handler event="keypress" keycode="VK_ENTER" action="this.click()" />
<handler event="keypress" keycode="VK_RETURN" action="this.click()" />
<handler event="click" button="0" count="1">
<![CDATA[
var url = this.href;
if (this.partner == "true")
url = url + "?partner=" + this._mgrSvc.partner;
var from = (this.from) ? this._mgrSvc.getPref("links." + this.from) :
"current";
this._mgrSvc.openLink(url, from);
]]>
</handler>
</handlers>
</binding>
</bindings>